home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 2 / Amiga Tools 2.iso / tools / vim / src / macros.h < prev    next >
Text File  |  1995-03-09  |  1KB  |  49 lines

  1. /* vi:ts=4:sw=4
  2.  *
  3.  * VIM - Vi IMproved        by Bram Moolenaar
  4.  *
  5.  * Read the file "credits.txt" for a list of people who contributed.
  6.  * Read the file "uganda.txt" for copying and usage conditions.
  7.  */
  8.  
  9. /*
  10.  * macros.h: macro definitions for often used code
  11.  */
  12.  
  13. /*
  14.  * pchar(lp, c) - put character 'c' at position 'lp'
  15.  */
  16. #define pchar(lp, c) (*(ml_get_buf(curbuf, (lp).lnum, TRUE) + (lp).col) = (c))
  17.  
  18. /*
  19.  * Position comparisons
  20.  */
  21. #define lt(a, b) (((a).lnum != (b).lnum) \
  22.                    ? ((a).lnum < (b).lnum) : ((a).col < (b).col))
  23.  
  24. #define ltoreq(a, b) (((a).lnum != (b).lnum) \
  25.                    ? ((a).lnum < (b).lnum) : ((a).col <= (b).col))
  26.  
  27. #define equal(a, b) (((a).lnum == (b).lnum) && ((a).col == (b).col))
  28.  
  29. /*
  30.  * lineempty() - return TRUE if the line is empty
  31.  */
  32. #define lineempty(p) (*ml_get(p) == NUL)
  33.  
  34. /*
  35.  * bufempty() - return TRUE if the file buffer is empty
  36.  */
  37. #define bufempty() (curbuf->b_ml.ml_flags & ML_EMPTY)
  38.  
  39. /*
  40.  * On some systems toupper()/tolower() only work on lower/uppercase characters
  41.  */
  42. #if defined(sequent) || defined(DOMAIN) || !defined(__STDC__)
  43. # define TO_UPPER(c)    (islower(c) ? toupper(c) : (c))
  44. # define TO_LOWER(c)    (isupper(c) ? tolower(c) : (c))
  45. #else
  46. # define TO_UPPER        toupper
  47. # define TO_LOWER        tolower
  48. #endif
  49.